import allStore from '../stores';
window.attentionUtil = (function(){
    return {
        doAttentionType(requestid){
            let e = event || window.event;
            let offset = jQuery(".wf_attention_span_typeset").offset();
            const { followSelectStore } = allStore;
            // followSelectStore.setClickPotion({'x':e.clientX,'y':e.clientY})
            followSelectStore.setClickPotion({'x':offset.left,'y':offset.top+10});
			followSelectStore.followTypeSelectShow=true;
			followSelectStore.FollowRequestid=requestid;
        },
        doAttention(requestid,id,rand){
            var divId = "attentionDiv_"+requestid+"_"+id+"_"+rand;
            var spanId = "attentionSpan_"+requestid+"_"+id+"_"+rand;
            if(jQuery("#"+divId).find("span").length == 0){
            	jQuery("#"+divId).addClass("wf_attention_div_btn_selected");
                jQuery("#"+divId).append("<span id='"+spanId+"' class='wf_attention_span_delbtn' onclick=\"attentionUtil.doDel("+requestid+","+id+",'"+rand+"')\">X</span>");
			}else{
                jQuery("#"+divId).removeClass("wf_attention_div_btn_selected");
                jQuery("#"+spanId).remove();
            }
        },
		doDel(requestid,id,rand){
			window.followTypeSettingStore.reqid = requestid
			window.followTypeSettingStore.saveAttention({
				src:'del',
				requestids:requestid,
				ids:id,
				rand:rand
            },"single")
		}
    }
})();